import React from 'react'
import {Modal} from 'antd'
import Lng from './lng';

const showErrorModal = (props) => {
    Modal.error({
        title: props.title ? props.title : Lng.get("common.systemTips"),
        content: props.content,
        okText: Lng.get("common.ok"),
        onOk: props.onOk ? props.onOk : null
    })
}

const showInfoModal = (props) => {
    Modal.info({
        title: props.title ? props.title : Lng.get("common.systemTips"),
        content: props.content,
        okText: Lng.get("common.ok"),
        onOk: props.onOk ? props.onOk : null
    })
}

const showSuccessModal = (props) => {
    Modal.success({
        title: props.title ? props.title : Lng.get("common.systemTips"),
        content: props.content,
        okText: Lng.get("common.ok"),
        onOk: props.onOk ? props.onOk : null
    })
}

const showConfirmModal = (props) => {
    Modal.confirm({
        title: props.title ? props.title : Lng.get("common.systemTips"),
        content: props.content,
        okText: props.okText || Lng.get("common.ok"),
        cancelText: Lng.get("common.cancel"),
        onOk: props.onOk ? props.onOk : null
    })
}


class ModalTips {
    static error(props) {
        showErrorModal(props);
    }

    static info(props) {
        showInfoModal(props);
    }

    static success(props) {
        showSuccessModal(props);
    }

    static confirm(props) {
        showConfirmModal(props);
    }
}

export default ModalTips;